package com.maxsalad.common.util;

import java.util.Map;

/**
 * Created by 2014-400 on 2016-01-22.
 */
public class ConfigUtil {
    public static Map<String, String> getProps() throws Exception {
        return PropertiesUtil.getMap("config.properties");
    }

    public static String getValue(String key) throws Exception {
        Map map = getProps();
        if (map.containsKey(key)) {
            return map.get(key).toString();
        }
        return "";
    }

    public static String getAppId() throws Exception {
        Map map = getProps();
        if (map.containsKey("APP_ID")) {
            return map.get("APP_ID").toString();
        }
        return "";
    }

    public static String getAppKey() throws Exception {
        Map map = getProps();
        if (map.containsKey("APP_KEY")) {
            return map.get("APP_KEY").toString();
        }
        return "";
    }

    public static String getAccessToken() throws Exception {
        Map map = getProps();
        if (map.containsKey("AccessToken")) {
            return map.get("AccessToken").toString();
        }
        return "";
    }

    public static String getRefreshToken() throws Exception {
        Map map = getProps();
        if (map.containsKey("RefreshToken")) {
            return map.get("RefreshToken").toString();
        }
        return "";
    }
}
